//index.js
//获取应用实例
const app = getApp()
Page({
  data: {
    avatarUrl:"",
    nickName:"",
		city:'',
		gender:0,
		province:'',
    flag: 0,
    show:0,
    userInfo: {},
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    
    kaoqu: '考区',
		nianfen: '年份',
    zhiwei_fenlei: '职位类型',
    xueli: '学历',
    liangnianjichen_jinyan: '基层工作最低年限',
		zhuanye:'相关专业及专业代码',
    inputValue: '',
    inputValue1: '',
    inputValue2: '',
    inputValue3: '',
    inputValue4: '',
    inputValue5: '',
    disabled:false,
    code: '',
    yzm: '获取验证码',
    paiming:0,
    inputValue2_1: '',
    inputValue3_1: '',
    inputValue4_1: '',
    inputValue5_1: '',
    inputValue7_1: '',
    list4:[],
    list1: [],
    list2: [],
		list3:[],
    iscode: null,
    dryingbtnid:1,
    _html:[],
    tel:"",
		user:{},
		hideFlag0:true,
    hideFlag: true,//true-隐藏  false-显示
    hideFlag1: true,
    hideFlag2: true,
    hideFlag3: true,
		 hideFlag4: true,
		 
    select: false,
    select1: false,
    select2: false,
    select3: false,
    animationData: {},//
    value: '考区',
		
		optionn:'',
		optionp:'',

		zhuanke:[],
		benke:[],
		yanjius:[],
		dazhuan_md:'',
		benke_md:'',
		yanjiusheng_md:''
		
  },
  
  //取消
  mCancel: function () {
    var that = this;
    that.hideModal();
  },
  //取消
  mCancel0: function () {
    var that = this;
    that.hideModal0();
  },
  // 显示遮罩层
  showModal: function () {
    var that = this;
    that.setData({
      hideFlag: false
    })
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速，ease->动画以低速开始，然后加快，在结束前变慢
    })
    this.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that.slideIn();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },


// 时间隐藏遮罩层
  hideModal0: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        hideFlag0: true
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画，再隐藏模块

  },
// 考区隐藏遮罩层
  hideModal: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        hideFlag: true
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画，再隐藏模块

  },


  mCancel1: function () {
    var that = this;
    that.hideModal1();
  },
  // 隐藏遮罩层
  hideModal1: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        hideFlag1: true
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画，再隐藏模块
  },

  mCancel2: function () {
    var that = this;
    that.hideModal2();
  },
  // 隐藏遮罩层
  hideModal2: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        hideFlag2: true
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画，再隐藏模块
  },
  mCancel3: function () {
    var that = this;
    that.hideModal3();
  },
  // 隐藏遮罩层
  hideModal3: function () {
    var that = this;
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间 默认400ms
      timingFunction: 'ease',//动画的效果 默认值是linear
    })
    this.animation = animation
    that.slideDown();//调用动画--滑出
    var time1 = setTimeout(function () {
      that.setData({
        hideFlag3: true
      })
      clearTimeout(time1);
      time1 = null;
    }, 220)//先执行下滑动画，再隐藏模块
  },
	
	  mCancel4: function () {
	  var that = this;
	  that.hideModal4();
	},
	// 隐藏遮罩层
	hideModal4: function () {
	  var that = this;
	  var animation = wx.createAnimation({
	    duration: 400,//动画的持续时间 默认400ms
	    timingFunction: 'ease',//动画的效果 默认值是linear
	  })
	  this.animation = animation
	  that.slideDown();//调用动画--滑出
	  var time1 = setTimeout(function () {
	    that.setData({
	      hideFlag4: true
	    })
	    clearTimeout(time1);
	    time1 = null;
	  }, 220)//先执行下滑动画，再隐藏模块
	},
  //动画 -- 滑入
  slideIn: function () {
    this.animation.translateY(0).step() // 在y轴偏移，然后用step()完成一个动画
    this.setData({
      //动画实例的export方法导出动画数据传递给组件的animation属性
      animationData: this.animation.export()
    })
  },
  //动画 -- 滑出
  slideDown: function () {
    this.animation.translateY(300).step()
    this.setData({
      animationData: this.animation.export(),
    })
  }, 
  onLoad: function (e) {
		let that = this;
		if(e.name&&e.phone){
			that.setData({
			  inputValue1: e.name,
				inputValue2: e.phone
			}) 
		}
    that.setData({
      role: app.globalData.role
    }) 
    
    if (app.globalData.userInfo) {
      this.setData({
        userInfo: app.globalData.userInfo,
        avatarUrl: app.globalData.userInfo.avatarUrl,
        nickName: app.globalData.userInfo.nickName,
				city: app.globalData.userInfo.city,
				gender: app.globalData.userInfo.gender,
				province: app.globalData.userInfo.province,
        hasUserInfo: true
      })
    } else if (this.data.canIUse) {
      // 由于 getUserInfo 是网络请求，可能会在 Page.onLoad 之后才返回
      // 所以此处加入 callback 以防止这种情况
      app.userInfoReadyCallback = res => {
        this.setData({
          userInfo: res.userInfo,
          avatarUrl: app.globalData.userInfo.avatarUrl,
          nickName: app.globalData.userInfo.nickName,
					city: app.globalData.userInfo.city,
					gender: app.globalData.userInfo.gender,
					province: app.globalData.userInfo.province,
          hasUserInfo: true
        })
      }
    } else {
      // 在没有 open-type=getUserInfo 版本的兼容处理
      wx.getUserInfo({
        success: res => {
          app.globalData.userInfo = res.userInfo
          this.setData({
            userInfo: res.userInfo,
            avatarUrl: app.globalData.userInfo.avatarUrl,
            nickName: app.globalData.userInfo.nickName,
						city: app.globalData.userInfo.city,
						gender: app.globalData.userInfo.gender,
						province: app.globalData.userInfo.province,
            hasUserInfo: true
          })
        }
      })
    };
   
  },
  getUserInfo: function (e) {
    app.globalData.userInfo = e.detail.userInfo
    app.globalData.code = e.detail.code
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    });
  },
  //更多跳转
  more: function (e) {
    var _that = this;
    if (_that.data.userInfo == undefined) {
      var userInfo = ""
    } else {
      var userInfo = _that.data.userInfo;
    }
    var phone = _that.data.phone;
    wx.redirectTo({
      url: "../more/more?userInfo=" + JSON.stringify(userInfo) + "&phone=" + _that.data.tel
    })
  },
  //排名弹窗
  tchide:function(e){
    this.setData({
      paiming: 0
    })
  },
  //获取姓名value值
  bindKeyInput1: function (e) {
    this.setData({
      inputValue1: e.detail.value,
      inputValue1_1: 1
    })
  },
  inputBlur1: function (e) {
    this.setData({
      inputValue1_1: 0
    });
  },
  //获取手机号value值
  bindKeyInput2: function (e) {
    console.log(e)
    this.setData({
      inputValue2: e.detail.value,
      inputValue2_1: 1
    })
  },
  inputBlur2: function (e) {
    this.setData({
      inputValue2_1: 0
    });
  },
  //获取部门代码value值
  bindKeyInput4: function (e) {
    this.setData({
      inputValue4: e.detail.value,
      inputValue4_1: 1
    })
  },
  inputBlur4: function (e) {
    this.setData({
      inputValue4_1: 0
    });
  },
  //获取职位代码value值
  bindKeyInput5: function (e) {
    this.setData({
      inputValue5: e.detail.value,
      inputValue5_1: 1
    })
  },
  inputBlur5: function (e) {
    this.setData({
      inputValue5_1: 0
    });
  },
  //事件处理函数
  bindViewTap: function() {
    wx.redirectTo({
      url: '../logs/logs'
    })
  },
  //信息查询切换
  switchNav: function (e) {
    console.log(e.currentTarget.id);    
    if (e.currentTarget.id==0){
      this.setData({
        dryingbtnid:1
      })
      console.log(this.data.dryingbtnid)
    }else{
      this.setData({
        dryingbtnid:2
      })
      console.log(this.data.dryingbtnid)
    }
    this.setData({
      flag: e.currentTarget.id,
      show: e.currentTarget.id
    })
  },
	 //时间下拉
	bindShowMsg0() {
	  var that = this;
	  that.setData({
	    hideFlag0: false,
	    list4: [],
	    list1: [],
	    list2: [],
			list3:[],
	    zhuanye: '相关专业及专业代码',
			zhiwei_fenlei:'职位类型',
	    xueli: '学历',
	    liangnianjichen_jinyan: '基层工作最低年限',
			kaoqu:'考区',
			zhuanke:[],
			benke:[],
			yanjius:[]
	  })
	  // 创建动画实例
	  var animation = wx.createAnimation({
	    duration: 400,//动画的持续时间
	    timingFunction: 'ease',//动画的效果 默认值是linear->匀速，ease->动画以低速开始，然后加快，在结束前变慢
	  })
	  this.animation = animation; //将animation变量赋值给当前动画
	  var time1 = setTimeout(function () {
	    that.slideIn();//调用动画--滑入
	    clearTimeout(time1);
	    time1 = null;
	  }, 100)
	},
	mySelect0(e) {
	  var name = e.currentTarget.dataset.name
	  this.setData({
	    nianfen: name,
	    hideFlag0: true
	  })
	},
  //考区下拉
  bindShowMsg() {
    var that = this;
		let nianfen = this.data.nianfen;
    that.setData({
      hideFlag: false,
      list4: [],
      list1: [],
      list2: [],
			list3:[],
      zhuanye: '相关专业及专业代码',
			zhiwei_fenlei:'职位类型',
      xueli: '学历',
      liangnianjichen_jinyan: '基层工作最低年限',
			zhuanke:[],
			benke:[],
			yanjius:[]
    })
		if (nianfen == "年份") {
		  this.setData({
		    hideFlag: true,
		  })
			wx.showToast({
			  title: '请先选择年份',
			  icon: 'none',
			  duration: 1000,
			})
		} else {
		  this.setData({
		    hideFlag: false,
		  })
		}
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速，ease->动画以低速开始，然后加快，在结束前变慢
    })
    this.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that.slideIn();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },
  mySelect(e) {
    var name = e.currentTarget.dataset.name
    this.setData({
      kaoqu: name,
      hideFlag: true
    })
  },
   //职位分类下拉
  bindShowMsg1() {
		this.setData({
			zhuanke:[],
			benke:[],
			yanjius:[]
		})
    let kaoqu = this.data.kaoqu;
		let nianfen = this.data.nianfen;
    let that1 = this;
  	let arr=[]
    wx.request({
      url: 'https://zg99.offcn.com/index/shaifen/getfzinfo?actid=12241&callback=?',
      data: {
        kaoqu: kaoqu,
				nianfen:nianfen,
      },
      headers: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        let bbb = res.data.replace(/(^\(*|\)*$)/g, "")
				console.log(JSON.parse(bbb))
					if(JSON.parse(bbb).msg=="暂无数据"){
						if (kaoqu == "考区") {
						  that1.setData({
						    hideFlag1: true,
						  })
							wx.showToast({
							  title: '请先选择考区',
							  icon: 'none',
							  duration: 1000,
							})
						}else{
							that1.setData({
									hideFlag1: true,
								})
							wx.showToast({
							  title: '暂无数据！',
							  duration: 2000
							})
							return false
						}
				}
        let obj = JSON.parse(bbb).lists
        for (var i = 0; i < obj.length;i++){
          arr.push(obj[i].zhiwei_fenlei)
        }
				console.log(arr)
  			arr=Array.from(new Set(arr))
        that1.setData({
          list3: arr,
        })
			
      },
      fail: function (res) {
        wx.showToast({
          title: '数据获取失败！',
          duration: 2000
        })
      }
    });
    if (kaoqu == "考区") {
      this.setData({
        hideFlag1: true,
      })
  		wx.showToast({
  		  title: '请先选择考区',
  		  icon: 'none',
  		  duration: 1000,
  		})
    } else {
      this.setData({
        hideFlag1: false,
      })
    }
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速，ease->动画以低速开始，然后加快，在结束前变慢
    })
    this.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that1.slideIn();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },
  mySelect1(e) {
    let name1 = e.currentTarget.dataset.name
    this.setData({
      zhiwei_fenlei: name1,
      hideFlag1: true,
    })
  },
  //学历下拉
  bindShowMsg2() {
		this.setData({
			zhuanke:[],
			benke:[],
			yanjius:[]
		})
    let that1 = this;
		let zhiwei_fenlei = this.data.zhiwei_fenlei;
    if (zhiwei_fenlei == "职位类型") {
      this.setData({
        hideFlag2: true,
      })
			wx.showToast({
			  title: '请先职位分类',
			  icon: 'none', 
			  duration: 1000,
			})
    } else {
      this.setData({
        hideFlag2: false,
      })
    }
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速，ease->动画以低速开始，然后加快，在结束前变慢
    })
    this.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that1.slideIn();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },
  mySelect2(e) {
    var name2 = e.currentTarget.dataset.name
    this.setData({
      xueli: name2,
      hideFlag2: true,
    })
  },
  //基层工作最低年限下拉
  bindShowMsg3() {
		this.setData({
			zhuanke:[],
			benke:[],
			yanjius:[]
		})
		let xueli = this.data.xueli;
		let that2=this
    if (xueli == "学历") {
      this.setData({
        hideFlag3: true,
      })
			wx.showToast({
			  title: '请先选择学历',
			  icon: 'none',
			  duration: 1000,
			})
    } else {
      this.setData({
        hideFlag3: false,
      })
    }
    // 创建动画实例
    var animation = wx.createAnimation({
      duration: 400,//动画的持续时间
      timingFunction: 'ease',//动画的效果 默认值是linear->匀速，ease->动画以低速开始，然后加快，在结束前变慢
    })
    this.animation = animation; //将animation变量赋值给当前动画
    var time1 = setTimeout(function () {
      that2.slideIn();//调用动画--滑入
      clearTimeout(time1);
      time1 = null;
    }, 100)
  },
  mySelect3(e) {
    var name3 = e.currentTarget.dataset.name
    this.setData({
      liangnianjichen_jinyan: name3,
      hideFlag3: true
    })
  },
	//相关专业
	bindShowMsg4() {
	  let kaoqu = this.data.kaoqu;
	 let xueli = this.data.xueli;
	 let 	liangnianjichen_jinyan = this.data.	liangnianjichen_jinyan;
	 let zhiwei_fenlei = this.data.zhiwei_fenlei;
	  let nianfen = this.data.nianfen;
	  let that2 = this;
	    wx.request({
	    url: 'https://zg99.offcn.com/index/shaifen/getfzinfo?actid=12241&callback=?',
	    data: {
				nianfen:nianfen,
	      kaoqu: kaoqu,
	      xueli: xueli,
				liangnianjichen_jinyan:liangnianjichen_jinyan,
				zhiwei_fenlei:zhiwei_fenlei
	    },
	    headers: {
	      'Content-Type': 'application/json'
	    },
	    success: function (res) {
	      let bbb = res.data.replace(/(^\(*|\)*$)/g, "")
				console.log(JSON.parse(bbb))
				if(JSON.parse(bbb).msg=="暂无数据"){
					if (liangnianjichen_jinyan=="基层工作最低年限"){
					  that2.setData({
					    hideFlag4: true,
					  })
							wx.showToast({
						  title: '请先选择基层工作最低年限',
						  icon: 'none',
						  duration: 1000,
						})
					}else{
						that2.setData({
								hideFlag4: true,
							})
						wx.showToast({
						  title: '暂无相关专业！',
						  duration: 2000
						})
						return false
					}
				}
				let obj = JSON.parse(bbb).lists
				//进行大专学历判断
				if(xueli=="大专"){
					let arr=[]
					for (let i = 0; i < obj.length;i++){
								arr.push(obj[i].dazhuan_md)
					}
					arr=Array.from(new Set(arr))
					that2.setData({
					  zhuanke: arr,
					})
					}
					//进行本科学历判断
					if(xueli=="本科"){
						let arr=[]
						for (let i = 0; i < obj.length;i++){
									arr.push(obj[i].benke_md)
						}
						arr=Array.from(new Set(arr))
						that2.setData({
						  benke: arr,
						})
						}
					
					//进行大专学历判断
					if(xueli=="研究生"){
						let arr=[]
						for (let i = 0; i < obj.length;i++){
									arr.push(obj[i].yanjiusheng_md)
						}
						arr=Array.from(new Set(arr))
						that2.setData({
						  yanjius: arr,
						})
						}
			
					
				//	进行大专以上学林进行判断
				if(xueli=="大专以上"){
					let arr1=[]
					let arr2=[]
					let arr3=[]
					arr1.push('大专专业要求')
					for(let i=0;i<obj.length;i++){
						arr1.push(obj[i].dazhuan_md)
					}
					arr1=Array.from(new Set(arr1))
					that2.setData({
					  zhuanke: arr1,
					})
					arr2.push('本科专业要求')
						for(let i=0;i<obj.length;i++){
						arr2.push(obj[i].benke_md)
					}
					arr2=Array.from(new Set(arr2))
				that2.setData({
				  benke: arr2,
				})
					  arr3.push('研究生专业要求')
						for(let i=0;i<obj.length;i++){
						arr3.push(obj[i].yanjiusheng_md)
					}
					arr3=Array.from(new Set(arr3))
					that2.setData({
					  yanjius: arr3,
					})
				}
				//	进行大专、本科学历进行判断
					if(xueli=="大专、本科"){
						let arr1=[]
						let arr2=[]
						arr1.push('大专专业要求')
						for(let i=0;i<obj.length;i++){
							arr1.push(obj[i].dazhuan_md)
						}
						arr1=Array.from(new Set(arr1))
						that2.setData({
						  zhuanke: arr1,
						})
						arr2.push('本科专业要求')
							for(let i=0;i<obj.length;i++){
							arr2.push(obj[i].benke_md)
						}
						arr2=Array.from(new Set(arr2))
						that2.setData({
						  benke: arr2,
						})
					}
					if(xueli=="本科以上"){
						let arr2=[]
						let arr3=[]
            arr2.push('本科专业要求')
						for(let i=0;i<obj.length;i++){
						arr2.push(obj[i].benke_md)
					}
					arr2=Array.from(new Set(arr2))
						that2.setData({
					  benke: arr2,
					})
            arr3.push('研究生专业要求')
						for(let i=0;i<obj.length;i++){
						arr3.push(obj[i].yanjiusheng_md)
					}
					arr3=Array.from(new Set(arr3))
						that2.setData({
					  yanjius: arr3,
					})
					}
	    },
	    fail: function (res) {
	      wx.showToast({
	        title: '数据获取失败！',
	        duration: 2000
	      })
	    }
	  });
	  if (liangnianjichen_jinyan=="基层工作最低年限"){
	    this.setData({
	      hideFlag4: true,
	    })
				wx.showToast({
			  title: '请先选择基层工作最低年限',
			  icon: 'none',
			  duration: 1000,
			})
	  }else{
	    this.setData({
	      hideFlag4: false,
	    })
	  }    
	  // 创建动画实例
	  var animation = wx.createAnimation({
	    duration: 400,//动画的持续时间
	    timingFunction: 'ease',//动画的效果 默认值是linear->匀速，ease->动画以低速开始，然后加快，在结束前变慢
	  })
	  this.animation = animation; //将animation变量赋值给当前动画
	  var time1 = setTimeout(function () {
	    that2.slideIn();//调用动画--滑入
	    clearTimeout(time1);
	    time1 = null;
	  }, 100)
	},
	mySelect4(e) {
	  var name1 = e.currentTarget.dataset.name
	  this.setData({
	    zhuanye: name1,
			dazhuan_md:name1,
	    hideFlag4: true
	  })
	},
	mySelect5(e) {
	  var name1 = e.currentTarget.dataset.name
	  this.setData({
	    zhuanye: name1,
			benke_md:name1,
	    hideFlag4: true
	  })
	},
	mySelect6(e) {
	  var name1 = e.currentTarget.dataset.name
	  this.setData({
	    zhuanye: name1,
			yanjiusheng_md:'',
	    hideFlag4: true
	  })
	},
  //新用户查询
  getsearch:function(){
    var _that=this;
    var dryingbtnid = _that.data.dryingbtnid;  
    var typeid=_that.data.dryingbtnid;
    var myreg = /^1[3456789]\d{9}$/;
		var page=1
    if (_that.data.userInfo ==undefined){
      var nickname = "";
      var avatarurl = "";
      var userInfo=""
			var city = "";
			var gender = "";
			var province=""
    }else{
      var nickname = _that.data.userInfo.nickName;
      var avatarurl = _that.data.userInfo.avatarUrl;
      var userInfo = _that.data.userInfo;
			 var city = _that.data.userInfo.city;
			var gender = _that.data.userInfo.gender;
			var province = _that.data.userInfo.province;
    }
    
    console.log(JSON.stringify(userInfo))  
    // if (dryingbtnid==1){  
			console.log(this.data.list2)
			var nianfen = this.data.nianfen; 
      var kaoqu = this.data.kaoqu;
      var xueli = this.data.xueli;
			 var zhiwei_fenlei = this.data.zhiwei_fenlei;
      var liangnianjichen_jinyan = this.data.liangnianjichen_jinyan;
			var dazhuan_md = this.data.dazhuan_md;
			var benke_md = this.data.benke_md;
			var zhuanye = this.data.zhuanye;
			var yanjiusheng_md = this.data.yanjiusheng_md;
      var name = this.data.inputValue1;
      var phone = this.data.inputValue2;
				 console.log(2222)
      console.log(phone)
      console.log(avatarurl);
			 console.log(city);
			console.log(gender);
			console.log(province);
			if (nianfen=="年份"){
			  wx.showToast({
			    title: '年份不能为空',
			    icon: 'none',
			    duration: 1000
			  })
			  return false;
			}
      if (kaoqu=="考区"){
        wx.showToast({
          title: '考区不能为空',
          icon: 'none',
          duration: 1000
        })
        return false;
      }
			if (zhiwei_fenlei == "职位类型") {
			  wx.showToast({
			    title: '职位类型不能为空',
			    icon: 'none',
			    duration: 1000
			  })
			  return false;
			}
      if (xueli == "学历") {
        wx.showToast({
          title: '学历不能为空',
          icon: 'none',
          duration: 1000
        })
        return false;
      }
      if (liangnianjichen_jinyan == "基层工作最低年限") {
        wx.showToast({
          title: '基层工作最低年限不能为空',
          icon: 'none',
          duration: 1000
        })
        return false;
      }
			if (zhuanye == "相关专业及专业代码") {
			  wx.showToast({
			    title: '专业不能为空',
			    icon: 'none',
			    duration: 1000
			  })
			  return false;
			}
      var reg2 = /^[\u4e00-\u9fa5]{2,10}$/;
      if (name == "") {
        wx.showToast({
          title: '姓名不能为空',
          icon: 'none',
          duration: 1000
        })
        return false;
      } else if (!reg2.test(name)) {
        wx.showToast({
          title: '姓名长度应在2-10之间，中文字符',
          icon: 'none',
          duration: 1000
        })
        return false;
      }
      if (phone == "") {
        wx.showToast({
          title: '手机号不能为空',
          icon: 'none',
          duration: 1000
        })
        return false;
      } else if (!myreg.test(phone)) {
        wx.showToast({
          title: '请输入正确的手机号',
          icon: 'none',
          duration: 1000
        });
        return false;
      }
			console.log(4444)
				 wx.request({
				  url: 'https://zg99.offcn.com/index/shaifen/getphonestatus?actid=12241&callback=?',
				  data: {
				   phone: phone,
				  },
				  success: function (res) {
					 let bbb = res.data.replace(/(^\(*|\)*$)/g, "")
					let obj = JSON.parse(bbb)
					console.log(JSON.parse(bbb))
				  if (obj.status == 1) {
						app.globalData.login=1
				 wx.request({
						 url: 'https://zg99.offcn.com/index/shaifen/getfzinfo?actid=12241&callback=?',
				 data: {
					nianfen:nianfen,
					kaoqu:kaoqu,
					xueli:xueli,
					zhiwei_fenlei:zhiwei_fenlei,
					liangnianjichen_jinyan:liangnianjichen_jinyan,
					yanjiusheng_md:yanjiusheng_md,	
					benke_md:benke_md,
					dazhuan_md:dazhuan_md
				 },
					 success: function (res) {
						let bbb = res.data.replace(/(^\(*|\)*$)/g, "")
						let obj = JSON.parse(bbb)
						console.log(JSON.parse(bbb))
				 if (obj.status == 1) {
				 _that.setData({
					 _html: obj.lists,
				 })
				 console.log(obj.lists)
				 wx.redirectTo({
					 // url: "../pmjg/pmjg?html=_html&phone=tel"
					 url: '../pmjg/pmjg?html=' + JSON.stringify(_that.data._html) + '&phone=' + _that.data.inputValue2 + '&userInfo=' + JSON.stringify(userInfo)
				 })
				 }
					}
				 })
				  } else if (obj.status ==2) {
							wx.showToast({
							  title: '手机号码未注册请先注册',
							  icon: 'none',
							  duration: 1000
							})
						setTimeout(function(){
						 wx.navigateTo({
						  url: '../old_user/old_user?userInfo=' + JSON.stringify(userInfo)+ '&phone=' + _that.data.inputValue2+ '&name=' + _that.data.inputValue1
						})
						},1000)
				  }
				
				}
				})
			},
			getsearch1() {
				this.getsearch();
			},
			onReady:function(){
				app.getuser();
			},
  onShareAppMessage:function(){
    var that = this;
    　　// 设置菜单中的转发按钮触发转发事件时的转发内容
    　　var shareObj = {
      　　　　title: "转发的标题",        // 默认是小程序的名称(可以写slogan等)
      　　　　path: '/pages/share/share',        // 默认是当前页面，必须是以‘/’开头的完整路径
      　　　　imageUrl: '',     //自定义图片路径，可以是本地文件路径、代码包文件路径或者网络图片路径，支持PNG及JPG，不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4
      　　　　success: function (res) {
        　　　　　　// 转发成功之后的回调
        　　　　　　if (res.errMsg == 'shareAppMessage:ok') {
        　　　　　　}
      　　　　},
        fail: function () {
          　　　　　　// 转发失败之后的回调
          　　　　　　if (res.errMsg == 'shareAppMessage:fail cancel') {
            　　　　　　　　// 用户取消转发
          　　　　　　} else if (res.errMsg == 'shareAppMessage:fail') {
            　　　　　　　　// 转发失败，其中 detail message 为详细失败信息
          　　　　　　}
        　　　　},
        complete: function(){
          　　　　　　// 转发结束之后的回调（转发成不成功都会执行）
        　　　　}
    }
  } 
		})
  
	

